import { Component } from '@angular/core';

import { LoggerService } from './logger.service';

@Component({
  selector: 'zbparaent-live',
  styles: [],
  templateUrl: './live-parent.component.html',
  providers: [LoggerService],
})
export class ZBParamentLiveComponent {

  hasChild = false;
  hookLog: string[];
  heroName = '火蓝';
  private logger: LoggerService;

  constructor(logger: LoggerService) {
    this.logger = logger;
    this.hookLog = logger.logs;
  }

  toggleChild() {
    this.hasChild = !this.hasChild;
    if (this.hasChild) {
      this.heroName = '寒冰射手';
      this.logger.clearnMessage(); // clear log on create
    }
     this.hookLog = this.logger.logs;
    }

   updateHero() {
    this.heroName += '!';
   }
}
